<?php
//自动加载文件
function MyFunction()
{
    echo '我是自定义方法中的函数';
}

/**
 * 获取子孙树
 * @param   array $data 待分类的数据
 * @param   int /string   $id     要找的子节点id
 * @param   int $lev 节点等级
 */
function getSubTree($data, $depart_id = 0, $lev = 0)
{
    static $son = array();

    foreach ($data as $key => $value) {
        if($value['depart_pid'] == $depart_id) {
            $value['lev'] = $lev;
            $son[] = $value;
            getSubTree($data, $value['depart_id'], $lev + 1);
        }
    }
    return $son;
}
?>